<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TPOJ.Model.Problem>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%= Html.Encode(Model.UniqueID) %>
    --
    <%= Html.Encode(Model.Title) %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% var contests = (IList<TPOJ.Model.Contest>)ViewData["CurrentContests"]; %>
    <% if (contests.Count > 0) { %>
        <% foreach (var contest in contests) {%> 
        <%= Html.Encode(contest.Title) %>  
        <table class="currentContest">
            <tr>
            <% int i = -1; %>
            <%foreach (var p in contest.Problems.OrderBy(p=>p.UniqueID)) {%>  
            <% i++; %>
                  <th><%= Html.ActionLink(Html.Encode(Convert.ToChar('A' + i)), "Details", new { id=p.UniqueID}) %></th>
             <% } %>
             </tr>
        </table>
        <% } %>
    <% } %>
    <h1>
        <%= Html.Encode(Model.Title) %></h1>
        <br />
        <div class="facts">
            <table>
                <tr>
                    <td>
                        <b>Time Limit:</b>
                        <%= Html.Encode(Model.TimeLimit) %>MS
                    </td>
                    <td class="span">
                    </td>
                    <td>
                        <b>Memory Limit:</b>
                        <%= Html.Encode(Model.MemoryLimit) %>K
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Total Submissions:</b>
                        <%= Html.Encode(Model.Summit) %>
                    </td>
                    <td class="span">
                    </td>
                    <td>
                        <b>Accepted:</b>
                        <%= Html.Encode(Model.Solved) %>
                    </td>
                </tr>
            </table>
        </div>
    <h2>
        Description:</h2>
    <p>
        <%= Model.Description %></p>
    <h2>
        Input:</h2>
    <p>
        <%= Model.Input %></p>
    <h2>
        Output:</h2>
    <p>
        <%= Model.Output %></p>
    <h2>
        Sample Input:</h2>
    <p>
        <%= Model.SampleInput %></p>
    <h2>
        Sample Output:</h2>
    <p>
        <%= Model.SampleOutput %></p>
        <% if (Model.Hint != null)
           { %>
    <h2>
        Hint:</h2>
    <p>
        <%= Model.Hint%></p>
        <%} %>
    <h2>
        Source:</h2>
    <p>
        <%= Html.Encode(Model.Source) %></p>
        <fieldset>
        <legend>Jump in</legend>
        <% if ((bool)ViewData["inContest"]) { %>
        [<%= Html.ActionLink("Submit", "Index", "Submit", new { id = Model.UniqueID, contests = ViewData["ContestId"].ToString() }, null)%>]
        <% }
           else
           {%>
           [<%= Html.ActionLink("Submit", "Index", "Submit", new { id = Model.UniqueID }, null)%>]
           <% } %>
        [<%= Html.ActionLink("Status", "Status", "Problem", new { id = Model.UniqueID }, new { target = "_blank" })%>]    
        <% if ((bool)ViewData["inContest"]) { %>
        [<%= Html.ActionLink("Clarify", "Index", "Forum", new { id = Model.UniqueID }, new { target = "_blank" })%>]
        <% }
           else
           { %>
        [<%= Html.ActionLink("Discuss", "Index", "Forum", new { id = Model.UniqueID }, new { target = "_blank" })%>]
        <% } %>
        </fieldset>
</asp:Content>
